﻿@{
    ViewBag.Title = "Post List";
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}

@section ContentHead {   
    <link href="@Url.Content("~/Content/overcast/jquery-ui-1.8.11.custom.css")" rel="stylesheet" type="text/css" />  
    <link href="@Url.Content("~/Content/ui.jqgrid.css")" rel="stylesheet" type="text/css" media="screen" />
    <script src="@Url.Content("~/Scripts/grid.locale-en.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")" type="text/javascript"></script>    
    <script type="text/javascript">
        $(function () {
            $('#postList').jqGrid({
                url: '/Admin/Post/GetPosts',
                datatype: 'json',
                mtype: 'GET',
                colNames: ['Title', 'Post Date', 'Last Modified'],
                colModel: [
                            { name: 'Title', index: 'Title' },
                            { name: 'PostDate', index: 'PostDate', width: 30, align: 'center', sortable: true },
                            { name: 'LastModified', index: 'LastModified', width: 30, align: 'center', sortable: true },
                          ],
                rowNum: 25,
                rowList: [25, 50, 75, 100],
                pager: '#postListPager',
                width: 590,
                height: '100%',
                hidegrid: false,                              
                sortname: 'PostDate',
                viewrecords: true,
                sortorder: 'asc',
                viewrecords: true,
                caption: "Posts"                         
            });            
        });
    </script>

    @*Trick to get VS to pickup jQuery IntelliSense*@
    @if (false)  {         
        <script type="text/javascript" src="../../../../Scripts/jquery-1.4.1.min.js"></script> 
    }
}

<div class="left" id="content_outer">
	<div id="content">
        <h2>Post List</h2>	
            @Html.ActionLink("Create a New Post", "Create")
            <br /><br />
            <table id="postList"></table>       
            <div id="postListPager"></div>    	
	</div>
</div>

<div class="clearer">&nbsp;</div>